package cn.exrick.manager.service.impl;

import cn.exrick.manager.mapper.TbReportMapper;
import cn.exrick.manager.pojo.TbReport;
import cn.exrick.manager.pojo.TbReportExample;
import cn.exrick.manager.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    private TbReportMapper tbReportMapper;

    @Override
    public void addReport(TbReport report) {
        tbReportMapper.insert(report);
    }

    @Override
    public List<TbReport> getReportList() {
        TbReportExample example = new TbReportExample();
        example.setOrderByClause("year desc,month desc");
        return tbReportMapper.selectByExample(example);
    }
}
